package shapes;

public class HorizontalLine extends Line {

    public HorizontalLine(int length) {

        super(length);
        data = new char[1][length + 1];
    }

    @Override
    public void create() {
        for (int i = 0; i < length; i++) {
            data[0][i] = '*';
        }
    }

    @Override
    public String dataToString() {
        StringBuilder outputString = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            outputString.append(data[0][i]);
        }
        return outputString.toString();
    }

    public void modifyLineData(String inputString) {
        for (int i = 0; i < length; i++) {
            data[0][i] = inputString.charAt(i);
        }
    }
}
